<h1>Button</h1>

<p>Buttons are created using a sequence of Shapes that are drawn for each of three 
button states, Over, Up and Down. The Button data structure is used to select the 
shape that is drawn when the button is in a particular state. Creating a button 
with more than one Button, each referencing a different shape allows the button 
to be animated as it is clicked.</p>

<p>A shape is also used to define active area of the button. When defining the 
active area the outline of the shape defines the boundary of the area. The shape 
is not drawn when the button is displayed. The button will only respond to mouse 
events when the cursor is placed inside the active area.</p>

<table>

<tr>
<th>Field</th>
<th>Type</th>
<th>Size</th>
<th>Description</th>
</tr>

<tr>
<td nowrap valign="top">reserved</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">4</td>
<td>Reserved for future used. Always set to zero.</td>
</tr>

<tr>
<td nowrap valign="top">isActive</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">1</td>
<td>Flag indicating whether the shape defines the active area of a button.</td>
</tr>

<tr>
<td nowrap valign="top">isDown</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">1</td>
<td>Flag indicating whether the shape is displayed when the button is pushed.</td>
</tr>

<tr>
<td nowrap valign="top">isOver</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">1</td>
<td>Flag indicating whether the shape is displayed when cursor is over the active
area of the button.</td>
</tr>

<tr>
<td nowrap valign="top">isUp</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">1</td>
<td>Flag indicating whether the shape is displayed when cursor is outside the 
active area of the button.</td>
</tr>

<tr>
<td nowrap valign="top">identifier</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>The unique identifier of the shape that is drawn.</td>
</tr>

<tr>
<td nowrap valign="top">layer</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>The layer number defines the order in which shapes are displayed. Shapes 
with a higher layer number are displayed in front of those on a lower layer. 
Complex buttons can be created by displaying more than one shape for a given 
button state. The layer number may be in the range 1..65535 - the range is 
determined by the size of the field when the value is encoded to a Flash file - 
however the vast majority of buttons will typically only use layer numbers less 
than 10.</td>
</tr>

<tr>
<td nowrap valign="top">coordTransform</td>
<td nowrap valign="top">CoordTransform</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>A coordinate transform that will be applied to the shape when it is displayed. 
The transform is most commonly used to offset shapes to create a 3-D appearance. 
The size may also be changed allowing a single shape definition to be used to 
display buttons in a range of sizes while still maintaining the same look and 
feel.</td>
</tr>

<tr>
<td nowrap valign="top">colorTransform</td>
<td nowrap valign="top">ColorTransform</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>Optional. A colour transform that will be applied to the shape when it is 
displayed.</td>
</tr>

</table>


<p>A Button can define the appearance of the button for more than one state.
Similarly complex buttons can be created by defining more than one shape to 
be drawn for a given button state.</p>

<p>The purpose of the layer attribute is to define the order in which shapes are 
displayed for a given button state. This is analogous to the layer number in the 
Flash Player's display list - specified using commands such as PlaceObject. When 
a button is displayed it is placed on a single layer in the display list and the 
layer numbers assigned to shapes in a Button do not interfere with shapes 
assigned to the same layer in the display list.</p>

<p>The coordinate transform is used to change the appearance of the button without 
changing the original shape definitions. Similarly the colour transform is used
to change the colour displayed without changing the shape's definition.</p>

<h2>History</h2>

<p>Button represents the ButtonRecord structure from the Macromedia 
Flash (SWF) File Format Specification. It was introduced in Flash 1.</p>

